package com.kmgames.ballsengine.physics;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.World;

public class WorldManager {
	private World world;
	private DynamicObjectFactory dynamicObjectFactory;
	private StaticObjectFactory staticObjectFactory;

	public WorldManager() {
		world = new World(new Vector2(0, 0), false);
		dynamicObjectFactory = new DynamicObjectFactory(world);
		staticObjectFactory = new StaticObjectFactory(world);
	}

	public DynamicObjectFactory createDynamic() {
		return dynamicObjectFactory;
	}

	public StaticObjectFactory createStatic() {
		return staticObjectFactory;
	}

	public void setGravity(Vector2 gravity) {
		world.setGravity(gravity);
	}

	public void step() {
		world.step(Gdx.app.getGraphics().getDeltaTime(), 3, 3);
	}

	public void dispose() {
		world.dispose();
	}
}
